package com.example.shortbread;

import ohos.aafwk.ability.Ability;
import ohos.aafwk.content.Intent;
import ohos.agp.components.Text;
import shortbread.Shortbread;

/**
 * 首页
 *
 * @date 2021/5/26
 */
public class MainAbility extends Ability {
    @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
        setUIContent(ResourceTable.Layout_ability_main);
        Text books = (Text) findComponentById(ResourceTable.Id_books);
        Text favoriteBooks = (Text) findComponentById(ResourceTable.Id_favorite_books);
        Text movies = (Text) findComponentById(ResourceTable.Id_movies);
        Text addMovie = (Text) findComponentById(ResourceTable.Id_add_movie);
        books.setClickedListener(component -> Shortbread.createShortcutsById(
                MainAbility.this, "books"));
        favoriteBooks.setClickedListener(component -> Shortbread.createShortcutsById(
                MainAbility.this, "favorite_books"));
        movies.setClickedListener(component -> Shortbread.createShortcutsById(
                MainAbility.this, "movies"));
        addMovie.setClickedListener(component -> Shortbread.createShortcutsById(
                MainAbility.this, "add_movie"));
    }
}
